prod=$1 #2011MayJun_5kG
tag=$2
jdir=$3
taskname=dEdxCosmic

echo 0:$0
echo 1:$1
echo 2:$2
echo 3:$3

echo
echo ======================================================================== $prod ========================================================================
echo

####################

fvar=$(echo Task$taskname\Tree Task$taskname\Hist)   # "/CombinedTrackfit_")
gvar=$(echo CAUTION found exist created incorrect xlulog kill seg "AliAnalysisManager\:\:GetEntry" error exitreport xlu_bad strange Exited)


echo should submit:
ls /u/xlu/.data/cosmic/lists/$prod\_sublist/*X* | wc
echo finished:
ls $jdir/oe* | wc
echo chunks:
wc /u/xlu/.data/cosmic/lists/$prod\_chunk.log

for ff in $fvar
do
    echo "================================== $ff"
    find myRawAnaData/$taskname\Data$prod/$tag*/ | grep $ff |wc
done

for g0 in $gvar
do 
    gg=$(echo $g0 | tr -s '?' ' ')
    echo "================================== $gg"
    grep "$gg" $jdir/oe20* 
    grep "$gg" $jdir/oe20* | wc
done

exit

echo
echo "=========================================================================================================="
echo "=========================================================================================================="
echo "for 2009, starnard 1973 chunks: 63 seg (including 19 not found + 3 not exist 2011-0429-1628) ==> 1910 chunks" 
#"1851 chunks without run99152. 19 chunks not found, 2 chunks not exist, all included in seg 79 chunks ==> 1772 chunks"
echo 
echo "for 2011, standard 2660 chunks: 10 chunks not found, 4 output not created ==> 2646 chunks"
echo
echo "submitted" should be equal to "merged.root"
echo "chunks" should be equal to "TMP$taskname\", difference = "not found"/2 + "not created"
echo
echo "not exist includes (not created = good analysis with 0 events saved)"
echo "not found": exit directly
